package org.mzx.shortLink.adminn.common.config;

import lombok.RequiredArgsConstructor;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@RequiredArgsConstructor
public class RedissonConfig {
    @Bean
    public RedissonClient redissonClient(){
        // 配置
        Config config = new Config();
        //这个config要是redisson的config不要导错包
        //也可以使用useClusterServers添加集群地址

        /**
         * 目前是虚拟机的配置
         */
        config.useSingleServer().setAddress("redis://192.168.187.129:6379")
                .setPassword("mzx20040517");
        // 创建RedissonClient对象
        return Redisson.create(config);
    }
}
